/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SMADIGESTER_H
#define SMADIGESTER_H

#include <CoreFoundation/CoreFoundation.h>

/**
 * Create an MD5 signature of the data.
 *
 * @returns The digest signature of the data. Ownership follows the Create Rule.
 */

CFDataRef SMACreateMD5DigestFromData(CFAllocatorRef allocator, CFDataRef data);

/**
 * Create an MD5 signature of the data.
 *
 * @returns The digest signature of the data. Ownership follows the Create Rule.
 */

CFDataRef SMACreateMD5DigestFromBytes(CFAllocatorRef allocator, const UInt8* data, CFIndex length);

/**
 * Create an MD5 signature of the string. The string is encoded to its external form using the
 * specified encoding first. Then the signature is taken from the encoded string.
 *
 * @returns The digest signature of the encoded string or null of the string
 *          encoding failed. Ownership follows the Create Rule.
 */

CFDataRef SMACreateMD5DigestFromString(CFAllocatorRef allocator, CFStringRef data, CFStringEncoding encoding);

/**
 * Create an SHA1 signature of the string. The string is encoded to its external form using the
 * specified encoding first. Then the signature is taken from the encoded string.
 *
 * @returns The digest signature of the encoded string or null of the string
 *          encoding failed. Ownership follows the Create Rule.
 */

CFDataRef SMACreateSHA1DigestFromString(CFAllocatorRef allocator, CFStringRef data, CFStringEncoding encoding);

/**
 * Create an MD5 signature of the data.
 *
 * @returns The digest signature of the data. Ownership follows the Create Rule.
 */

CFStringRef SMACreateHexMD5DigestFromData(CFAllocatorRef allocator, CFDataRef data);

/**
 * Create an MD5 signature of the data.
 *
 * @returns The digest signature of the data. Ownership follows the Create Rule.
 */

CFStringRef SMACreateHexMD5DigestFromBytes(CFAllocatorRef allocator, const UInt8* data, CFIndex length);

/**
 * Create an MD5 signature of the string. The string is encoded to its external form using the
 * specified encoding first. Then the signature is taken from the encoded string.
 *
 * @returns The digest signature of the encoded string or null of the string
 *          encoding failed. Ownership follows the Create Rule.
 */

CFStringRef SMACreateHexMD5DigestFromString(CFAllocatorRef allocator, CFStringRef data, CFStringEncoding encoding);

//

CFDataRef SMACreateSHA1HMACDigestFromData(CFAllocatorRef allocator, CFDataRef data, CFDataRef key);
CFDataRef SMACreateSHA1HMACDigestFromString(CFAllocatorRef allocator, CFStringRef s, CFStringEncoding encoding, CFDataRef key);

#endif
